<%--
  Created by IntelliJ IDEA.
  User: fenglixiong
  Date: 2017/10/2
  Time: 15:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>用户列表</title>
    <script type="text/javascript" src="/static/js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/static/js/globalPage.js"></script>
    <script type="text/javascript">
        function loadDate(){
            document.fs.submit();
        }
    </script>
</head>
<body>
<%@include file="../head_include.jsp"%>
<h1>用户列表</h1>
<form name="fs" action="userList.htm" method="post">
    <input type="hidden" id="page" name="page" value="${ps.page}"/>
</form>
<a href="/user/userAdd.htm" target="_blank">添加用户</a>
<table border="1">
    <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Password</th>
            <th>Info</th>
            <th>operate</th>
        </tr>
    </thead>
    <tbody>
    <c:if test="${empty userList}">
        <tr>
            <td colspan="5">暂无数据！</td>
        </tr>
    </c:if>
    <c:if test="${not empty userList}">
        <c:forEach items="${userList}" var="user" varStatus="status">
            <tr>
                <td>${user.userId}</td>
                <td>${user.userName}</td>
                <td>${user.passWord}</td>
                <td>${user.info}</td>
                <td>
                    <a href="/user/userEdit.htm?userId=${user.userId}">修改</a>
                    <a href="/user/userDelete.htm?userId=${user.userId}">删除</a>
                </td>
            </tr>
        </c:forEach>
    </c:if>
    </tbody>
</table>
<div>
    <a href="javascript:void(0);" onclick="turnPage(1)">首页</a>
    <a href="javascript:void(0);" onclick="prePage()">上一页</a>
    <a href="javascript:void(0);" onclick="nextPage()">下一页</a>
    <a href="javascript:void(0);" onclick="turnPage('${ps.totalPage}')">尾页</a>
</div>

</body>
</html>
